package com.qf.team2.netdisc.controller;

import com.qf.team2.netdisc.common.base.BaseController;
import com.qf.team2.netdisc.common.pojo.entity.Document;
import com.qf.team2.netdisc.common.pojo.vo.RespResultVO;
import com.qf.team2.netdisc.service.DocumentDeleteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("document")
@Api(tags = "文件相关接口")

public class DocumentDeleteController extends BaseController<Object> {
    @Autowired
    private DocumentDeleteService documentDeleteService;

    @ResponseBody
    @RequestMapping(value = "delete", method = RequestMethod.POST)
    @ApiOperation("文件删除接口")
    public RespResultVO<Object> delete(@ApiParam(value = "文件删除") HttpServletRequest request) {
        try {
            Integer userId = 1;
            String url = "text\\.idea\\ppt素材\\";
            List<Document> list = documentDeleteService.checkUserCapacity(url, userId);
            return successResp(list, "删除成功");
        } catch (RuntimeException e) {
            e.printStackTrace();
            return failedResp(e.getMessage());
        }

    }
}